<?php
global $_W, $_GPC;
$uid = $_GPC['uid'];
if(empty($uid)){
    return $this->getresult(1,'请先登录',array('code'=>3001,'msg'=>'请先登录'));
}
/***校验token开始***/
if($uid){
    $token = $_GPC['token'];
    if (empty($token)) {
        return $this->getresult(1, '请重新登录', ['code' => 4001, 'msg' => '请重新登录']);
    }
    $token_result = $this->checktoken($uid, $token);
    if ($token_result == 1002) {
        return $this->getresult(1, '请重新登录', ['code' => 4002, 'msg' => '请重新登录']);
    } elseif ($token_result == 1003) {
        return $this->getresult(1, '请重新登录', ['code' => 4003, 'msg' => '请重新登录']);
    }elseif ($token_result == 1001) {
        //  更新token
        pdo_update($this->t_user_token,array('createtime'=>time()),array('uid' => $uid, 'token' => $token, 'weid' => $_W['uniacid']));
    }
}
/***校验token结束***/
$weid = $_W['uniacid'];
$practiceid = $_GPC['practiceid'];
$params = [':weid' => $weid, ':uid' => $uid, ':is_delete' => 1, ':practiceid' => $practiceid];
$condition = ' weid = :weid AND uid = :uid AND is_delete = :is_delete AND practiceid = :practiceid ';
$check = pdo_fetchcolumn("select id from " . tablename('goouc_class_practice_false_record') . "  where " . $condition, $params);
if ($check) {
    $data['is_delete'] = 2;
    pdo_update('goouc_class_practice_false_record', $data, array('practiceid' => $practiceid, 'weid' => $weid, 'uid' => $uid));
    return $this->getresult(0, '删除成功',array('code' => 200, 'msg' => '删除成功'));
} else {
    return $this->getresult(1, '请刷新后重试',array('code' => 3001, 'msg' => '请刷新后重试'));
}